<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Jsp登录Demo</title>
	</head>
	<body>
		<%
			String submitFlag = request.getParameter("submitFlag");
			if ("checkLogin".equals(submitFlag)) {
				String username = request.getParameter("username");
				String password = request.getParameter("password");
				if ("yaoper".equals(username) && "12345".equals(password)) {
					out.write("<h1 style='color:red'>login success!</h1>");
				} else {
					out.write("<h1>login fail!~~~~(>_<)~~~~</h1>");
				}
			} else {
			%>
				<form action="" method="post">
					<input type="hidden" name="submitFlag" value="checkLogin"/>
					username:<input type="text" name="username"/><br/>
					password:<input type="password" name="password"/><br/>
					<input type="submit" value="login"/>
				</form>
			<%
				}
			%>
	</body>
</html>